package com.itestor.iptv.modules.alert.vo;

import java.io.File;
import com.itestor.iptv.modules.alert.domain.RobotLog;
import com.itestor.iptv.modules.ne.domain.RobotFileInfo;
import com.itestor.iptv.modules.ne.domain.RobotManage;

/**
 * 
 * @author Mr.li
 * 
 */
public class RobotLogBean {
    
    public  static String LOCAL_DIR_VIDEOFILEDIR ="/video";
    public  static String LOCAL_DIR_FILE_PCAPFILEDIR ="/video";
    public  static String LOCAL_DIR_PIC ="/pic";
    
    private RobotLog robotlog;

    private RobotManage robotManage;

    private RobotFileInfo robotFileInfo;

    /**
     * 构造器
     */
    public RobotLogBean() {

    }

    /**
     * 构造器
     * @param robotlog
     * @param robotManage
     */
    public RobotLogBean(RobotLog robotlog, RobotManage robotManage) {
        this.robotlog = robotlog;
        this.robotManage = robotManage;
    }

    /**
     * 构造器
     * @param robotlog
     * @param robotFileInfo
     */
    public RobotLogBean(RobotLog robotlog, RobotFileInfo robotFileInfo) {
        this.robotlog = robotlog;
        this.robotFileInfo = robotFileInfo;
    }

    /**
     * 构造器
     * @param robotlog
     * @param robotManage
     * @param robotFileInfo
     */
    public RobotLogBean(RobotLog robotlog, RobotManage robotManage,
            RobotFileInfo robotFileInfo) {
        this.robotlog = robotlog;
        this.robotManage = robotManage;
        this.robotFileInfo = robotFileInfo;
    }

    public RobotLog getRobotlog() {
        return robotlog;
    }

    public RobotManage getRobotManage() {
        return robotManage;
    }

    public void setRobotlog(RobotLog pRobotlog) {
        robotlog = pRobotlog;
    }

    public void setRobotManage(RobotManage pRobotManage) {
        robotManage = pRobotManage;
    }

    public RobotFileInfo getRobotFileInfo() {
        return robotFileInfo;
    }

    public void setRobotFileInfo(RobotFileInfo pRobotFileInfo) {
        robotFileInfo = pRobotFileInfo;
    }

    /**
     * 
     * @return
     */
    public String getRemoteVideoFileURL() {
        String webHost = robotFileInfo.getWebHost();
        String videoUrlDir = robotFileInfo.getVideoUrlDir();
        String videoFile = robotlog.getVideoFile();
        StringBuffer sb = new StringBuffer();
        sb.append(webHost);        
        if (!videoUrlDir.startsWith("/")) {
            sb.append("/");
        }
        sb.append(videoUrlDir);
        if (!videoUrlDir.endsWith("/")) {
            sb.append("/");
        }
        sb.append(videoFile);
        return sb.toString();
    }

    /**
     * 
     * @return
     */
    public String getRemotePrePcapFileURL() {
        String webHost=robotFileInfo.getWebHost();        
        String pcapUrlDir =robotFileInfo.getPcapUrlDir();        
        String prePcapFile=robotlog.getPrePcapFile();
        
        StringBuffer sb = new StringBuffer();        
        sb.append(webHost);
        
        if (!pcapUrlDir.startsWith("/")) {
            sb.append("/");
        }
        sb.append(pcapUrlDir);
        
        if (!pcapUrlDir.endsWith("/")) {
            sb.append("/");
        }        
        sb.append(prePcapFile);
        
        return sb.toString();
    }

    /**
     * 
     * @return
     */
    public String getRemotePcapFileURL() {
        
        String webHost=robotFileInfo.getWebHost();        
        String pcapUrlDir =robotFileInfo.getPcapUrlDir();        
        String pcapFile=robotlog.getPcapFile();
        
        StringBuffer sb =new StringBuffer();
        
        sb.append(webHost);
        if (!pcapUrlDir.startsWith("/")) {
            sb.append("/");
        }        
        sb.append(pcapUrlDir);
        if (!pcapUrlDir.endsWith("/")) {
            sb.append("/");
        }   
        sb.append(pcapFile);
        
        return sb.toString();
    }

    /**
     * 
     * @return
     */
    public String getLocalVideoFileURL() {
        return LOCAL_DIR_VIDEOFILEDIR + File.separator+robotlog.getIdRobot()+File.separator
                + robotlog.getVideoFile();
    }

    /**
     * 
     * @return
     */
    public String getLocalPrePcapFileURL() {
        return LOCAL_DIR_FILE_PCAPFILEDIR + File.separator+robotlog.getIdRobot()+File.separator
                + robotlog.getPrePcapFile();
    }

    /**
     * 
     * @return
     */
    public String getLocalPcapFileURL() {
        return LOCAL_DIR_FILE_PCAPFILEDIR + File.separator+robotlog.getIdRobot()+File.separator
                + robotlog.getPcapFile();
    }
    

}
